package cn.itsource.pet.service.impl;

import cn.hutool.core.util.IdUtil;
import cn.itsource.basic.config.exception.BusinessException;
import cn.itsource.basic.service.impl.BaseServiceImpl;
import cn.itsource.basic.util.*;
import cn.itsource.org.domain.Employee;
import cn.itsource.org.domain.Shop;
import cn.itsource.org.mapper.EmployeeMapper;
import cn.itsource.org.mapper.ShopMapper;
import cn.itsource.org.query.ShopQuery;
import cn.itsource.org.service.IShopService;
import cn.itsource.pet.domain.PetType;
import cn.itsource.pet.mapper.PetTypeMapper;
import cn.itsource.pet.query.PetTypeQuery;
import cn.itsource.pet.service.IPetTypeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class PetTypeServiceImpl extends BaseServiceImpl<PetType, PetTypeQuery> implements IPetTypeService {
    @Resource
    private PetTypeMapper petTypeMapper;

    @Override
    public JsonResult petTypeTree() {
        List<PetType> petTypes = petTypeMapper.selectPetType();
        List<PetType> tree = TreeUtil.getTree(petTypes);
        return JsonResult.createSuccess(tree);
    }
}
